package com.erpanderp.wam.adm.model.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.Transient;

public class ServiceGroup {
	private Long serviceGroupId;
	private String servicegroupName;
	private String displayName;
	private Date createDate;
	private Date dateModified;
	private String createdBy;
	private String modifiedby;
	private String description;
	private String status;
	private Module module;
	private List<Service> servicesList = new ArrayList<Service>();
	private Set<Service> services = new HashSet<Service>();
	private Set<RoleServiceGroup> roleServiceGroups = new HashSet<RoleServiceGroup>();
		
	private boolean assigned, checked;
	
	public Long getServiceGroupId() {
		return serviceGroupId;
	}
	public void setServiceGroupId(Long serviceGroupId) {
		this.serviceGroupId = serviceGroupId;
	}
	public String getServicegroupName() {
		return servicegroupName;
	}
	public void setServicegroupName(String servicegroupName) {
		this.servicegroupName = servicegroupName;
	}
	public String getDisplayName() {
		return displayName;
	}
	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}
	public Date getCreateDate() {
		return createDate;
	}
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	public Date getDateModified() {
		return dateModified;
	}
	public void setDateModified(Date dateModified) {
		this.dateModified = dateModified;
	}
	public String getCreatedBy() {
		return createdBy;
	}
	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}
	public String getModifiedby() {
		return modifiedby;
	}
	public void setModifiedby(String modifiedby) {
		this.modifiedby = modifiedby;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public Set<Service> getServices() {

		return services;
	}
	public void setServices(Set<Service> services) {
		this.services = services;
		this.servicesList.clear();
		this.servicesList.addAll(this.services);
	}	
	public Set<RoleServiceGroup> getRoleServiceGroups() {
		return roleServiceGroups;
	}
	public void setRoleServiceGroups(Set<RoleServiceGroup> roleServiceGroups) {
		this.roleServiceGroups = roleServiceGroups;
	}
	public Module getModule() {
		return module;
	}
	public void setModule(Module module) {
		this.module = module;
	}
	
	@Transient
	public boolean isAssigned() {
		return assigned;
	}
	public void setAssigned(boolean assigned) {
		this.assigned = assigned;
	}
	
	public boolean equals(Object obj){
		if(this == obj){
			return true;
		}
		
		if(this.getServiceGroupId().equals(((ServiceGroup)obj).getServiceGroupId())){
			return true;
		}
		return false;
	}
	@Transient
	public boolean isChecked() {
		return checked;
	}
	public void setChecked(boolean checked) {
		this.checked = checked;
	}
	public List<Service> getServicesList() {
		return servicesList;
	}
	public void setServicesList(List<Service> servicesList) {
		this.servicesList = servicesList;
	}

}
